
import java.util.Scanner;

class SALDO {

    public static void main(String[] args) {
        Scanner entrada = new Scanner(System.in);

        int N, X, Y, J = 0, I = 0, n = 0;

        N = entrada.nextInt();

        while (N != 0) {

            int i = 1, seq = 0, max = -1, ini = 1;

            while (i <= N) {
                X = entrada.nextInt();
                Y = entrada.nextInt();

                if ((X - Y + seq) >= 0) {
                    seq += (X - Y);
                    if (seq > max) {
                        max = seq;
                        I = ini;
                        J = i;
                    }
                    if (seq == max && (J - ini) < (i - ini)) {
                        I = ini;
                        J = i;
                    }
                } else {
                    ini = i + 1;
                    seq = 0;
                }
                i++;
            }
            System.out.println("Teste " + ++n);
            if (max > 0) {
                System.out.println(I + " " + J);
            } else {
                System.out.println("nenhum");
            }
            System.out.println();
            N = entrada.nextInt();
        }
    }
}
